﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
//using System.Data.Entity.ModelConfiguration.Conventions.Edm.Db;
using System.Data.Entity.ModelConfiguration;
using System.Data.Entity.ModelConfiguration.Conventions;
//using System.Data.Entity.ModelConfiguration.Conventions.Configuration;


namespace FilstartupsREST.Models
{
    public class FilStartUpsEntities :DbContext
    {
        public FilStartUpsEntities()
            : base("FILSTARTUPS_CMS")
        {
            System.Data.Entity.Database.SetInitializer<FilStartUpsEntities>(null);
        }

        public DbSet<Post> Posts { get; set; }
        public DbSet<Category> Categories { get; set; }
        public DbSet<Page> Pages { get; set; }
        public DbSet<Forum> Forums { get; set; }
        public DbSet<Event> Events { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();

            modelBuilder.Entity<Post>().ToTable("dbo.Post");
            modelBuilder.Entity<Post>().Property(p => p.postidPK);

            modelBuilder.Entity<Event>().ToTable("dbo.Event");
            modelBuilder.Entity<Event>().Property(e => e.eventidPK);

            modelBuilder.Entity<Category>().ToTable("dbo.Category");
            modelBuilder.Entity<Category>().Property(c => c.catidPK);

            modelBuilder.Entity<Forum>().ToTable("dbo.Forum");
            modelBuilder.Entity<Forum>().Property(f => f.forumidPK);

        }
    }
   
}